﻿using CCSFeederCameraUI2.Data.ViewModels;
using Prism.Commands;
using Prism.Ioc;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace TonyMES.ViewModels.Dialogs
{
    public class AddPointDialogViewModel : DialogViewModel
    {
        #region 属性
        private string lotNo;
        public string LotNo
        {
            get { return lotNo; }
            set { SetProperty(ref lotNo, value); }
        }
        private string partNo;
        public string PartNo
        {
            get { return partNo; }
            set { SetProperty(ref partNo, value); }
        }
        #endregion
        #region 变量
        private DelegateCommand<object> operateCommad;
        public DelegateCommand<object> OperateCommad =>
            operateCommad ?? (operateCommad = new DelegateCommand<object>(ExecuteOperateCommad));

        void ExecuteOperateCommad(object obj)
        {
            switch (obj.ToString())
            {
                case "确认":
                    DialogParameters param = new DialogParameters();
                    //param.Add("LotNo", LotNo);
                    param.Add("PartNo", PartNo);
                    OnRequestClose(new DialogResult(ButtonResult.Yes, param));
                    break;
                case "取消":
                    OnRequestClose(new DialogResult(ButtonResult.None));
                    break;
                default:
                    break;
            }
        }
        #endregion
        #region 导航
        public override void OnDialogOpened(IDialogParameters parameters)
        {
            LotNo = string.Empty;
            PartNo = string.Empty;
        }
        #endregion
        #region 构造函数
        public AddPointDialogViewModel(IContainerProvider containerProvider) : base(containerProvider)
        {
            Title = "添加FPC";
        }
        #endregion

    }
}
